﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using BLL;
using Model;
using Function;

namespace UI.Module.Coin
{
    public partial class ChangeCoinLogs : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        string Message = "";
        private void Bind(string Where_String = "")
        {
            int RecordCount = 0;
            DataTable Page_Dt = new DataTable();
            Page_Dt = BLL.PageQuery2005_BLL.SelectPage(out RecordCount, "LogNo, (select [name] from st_investor where id=InvestorID) as tzName,InvestorID, LogTime, (select Note from DY_CoinChangeItem where code=ItemID) as itemName, ChangeCoin, Coin, Note", "dbo.JL_ChangeCoinLogs", "investorid=" + Method.CurrentUserID, "[LogNo] desc", Pager.CurrentPageIndex,
                Pager.PageSize, PubConstant.DataBaseTarget.JHShop, out Message);

            if (!string.IsNullOrEmpty(Message))
            {
                MessageBox box = new MessageBox();
                box.ErrorBox(this, "数据查询失败!");
                return;
            }
            grdlist.DataSource = Page_Dt;
            grdlist.DataBind();
            this.Pager.RecordCount = RecordCount;
        }

        protected void grdlist_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowIndex != -1)
            {
                int indexID = (this.Pager.CurrentPageIndex - 1) * this.Pager.PageSize + e.Row.RowIndex + 1;
                e.Row.Cells[0].Text = indexID.ToString();
            }
        }

        protected void Pager_BindData(object sender, EventArgs e)
        {
            Bind((hidWhere.Value ?? "").ToString());
        }

    }
}